// index.js
// 获取应用实例
const App = getApp()

Page({
  data: {
    cardList:[
      

    ],
    config:{},
    navData:[]
  },

  onLoad() {


    this.getIndexData();
    this.gethuodongtype();
    this.gettype();
    
  },
  getIndexData: function () {
    let _this = this;

    App._post_form('wxapi/config', {}, function (result) {
      if (result.status == "200") {
        _this.setData({
          config: result.data
        });
        wx.setNavigationBarTitle({
          title: result.data.shoptitle
      })
      }

    });

  },
  gettype: function () {
    let _this = this;
    App._post_form('wxapi/category/lists', {
      type: 2,
      isrecommend:1
    }, function (result) {
      if (result.status == "200") {
        console.log("sssss", result.data);
        _this.setData({
          navData: result.data,
        });
       
      }

    });
  },
  gethuodongtype: function () {
    let _this = this;
    App._post_form('wxapi/category/lists', {
      type: 1
    }, function (result) {
      if (result.status == "200") {
        console.log("sssss", result.data);
        _this.setData({
          cardList: result.data,
        });
       
      }

    });
  },
  detail(e){
    let id = e.currentTarget.dataset.id;
    console.log("fffffffffffffffff",id,e);


    wx.reLaunch({
      url: '/pages/cakeMall/cakeMall?typeid=' + id 
    });
  },
  goodlist(e){
    
    let typeid = e.currentTarget.dataset.id;
    console.log(e,typeid);

    wx.navigateTo({
      url: '/pages/cakeMall/search/search?typeid=' + typeid,
    });
  },
  onShareAppMessage() {

  },
  onShareTimeline(){
    
  }
 
})
